<%--
  User: ssl
  Date: 2018-3-1
  Time: 17:28
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="nav-close">
        <i class="fa fa-times-circle"></i>
    </div>
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
						<span class="clear">
							<span class="block m-t-xs" style="font-size: 20px;">
								<i class="fa fa-area-chart"></i>
								<strong class="font-bold">RMS</strong>
							</span>
						</span>
                    </a>
                </div>
                <div class="logo-element">RMS</div>
            </li>
            <li class="hidden-folded padder m-t m-b-sm text-muted text-xs">
                <span class="ng-scope">导航</span>
            </li>
            <li class="<c:if test='${currentHref=="index"}'>active</c:if>">
                <a class="menuItem" href="${ctx}">
                    <i class="fa fa-home"></i>
                    <span class="nav-label">主页</span>
                </a>
            </li>
            <!-- 循环菜单 -->

            <!-- 循环菜单结束 -->
        </ul>
    </div>
</nav>
<script>
    /* 加载左侧菜单 */
    var side_menu = $("#side-menu");
    var menu = "";
    <c:forEach items="${menuList}" var="menu" varStatus="status">
    var menuHref = "${menu.href}";
    var menuLi = "";
    if (!!menuHref) {
        menuLi = '<li class=\"fatherLi\"><a class=\"menuItem\" href=\"${ctx}${menu.href}\"><i class=\"fa ${menu.icon}\"></i><span class=\"nav-label\">${menu.name}</span><span class=\"fa arrow\"></span></a>';
    } else {
        menuLi = '<li class=\"fatherLi\"><a class=\"menuItem\" href=\"javascript:;\"><i class=\"fa ${menu.icon}\"></i><span class=\"nav-label\">${menu.name}</span><span class=\"fa arrow\"></span></a>';
    }
    var menuChildMenu = "${fn:length(menu.childMenu)}";
    if (0<menuChildMenu) {
        var ul = '<ul class=\"nav nav-second-level collapse\">';
        var li = '';
        <c:forEach items="${menu.childMenu}" var="mu" varStatus="st">
        var currentHref = "${currentHref}";
        var muHref = "${mu.href}";
        if (currentHref==muHref) {
            menuLi = menuLi.replace("fatherLi","fatherLi active");
            ul = '<ul class=\"nav nav-second-level collapse in\" aria-expanded=\"true\">';
            li += '<li class=\"active\"><a class=\"menuItem\" href=\"${ctx}${mu.href}\">${mu.name}</a></li>';
        } else {
            li += '<li><a class=\"menuItem\" href=\"${ctx}${mu.href}\">${mu.name}</a></li>';
        }
        </c:forEach>
        ul += li;
        ul+= '</ul>';
        menu += menuLi;
        menu += ul;
    }
    menu += '</li>';
    </c:forEach>
    //console.log(menu);
    side_menu.append(menu);
    /* end */
</script>